package com.bsoft.gol.hbs.bbpmessagel.template;

import java.beans.ConstructorProperties;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class WxMpTemplateMessage implements Serializable {
	private static final long serialVersionUID = 5063374783759519418L;
	private String toUser;
	private String templateId;
	private String url;
	private WxMpTemplateMessage.MiniProgram miniProgram;
	private List<WxMpTemplateData> data;

	public WxMpTemplateMessage() {
	}

	@ConstructorProperties({"toUser", "templateId", "url", "miniProgram", "data"})
	public WxMpTemplateMessage(String toUser, String templateId, String url,
                               WxMpTemplateMessage.MiniProgram miniProgram, List<WxMpTemplateData> data) {
		this.toUser = toUser;
		this.templateId = templateId;
		this.url = url;
		this.miniProgram = miniProgram;
		this.data = data;
	}

	public static WxMpTemplateMessage.WxMpTemplateMessageBuilder builder() {
		return new WxMpTemplateMessage.WxMpTemplateMessageBuilder();
	}

	public WxMpTemplateMessage addData(WxMpTemplateData datum) {
		if (this.data == null) {
			this.data = new ArrayList();
		}

		this.data.add(datum);
		return this;
	}

	public String toJson() {
		return WxMpGsonBuilder.INSTANCE.create().toJson(this);
	}

	public String getToUser() {
		return this.toUser;
	}

	public void setToUser(String toUser) {
		this.toUser = toUser;
	}

	public String getTemplateId() {
		return this.templateId;
	}

	public void setTemplateId(String templateId) {
		this.templateId = templateId;
	}

	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public WxMpTemplateMessage.MiniProgram getMiniProgram() {
		return this.miniProgram;
	}

	public void setMiniProgram(WxMpTemplateMessage.MiniProgram miniProgram) {
		this.miniProgram = miniProgram;
	}

	public List<WxMpTemplateData> getData() {
		return this.data;
	}

	public void setData(List<WxMpTemplateData> data) {
		this.data = data;
	}

	public static class WxMpTemplateMessageBuilder {
		private String toUser;
		private String templateId;
		private String url;
		private WxMpTemplateMessage.MiniProgram miniProgram;
		private List<WxMpTemplateData> data;

		WxMpTemplateMessageBuilder() {
		}

		public WxMpTemplateMessage.WxMpTemplateMessageBuilder toUser(String toUser) {
			this.toUser = toUser;
			return this;
		}

		public WxMpTemplateMessage.WxMpTemplateMessageBuilder templateId(String templateId) {
			this.templateId = templateId;
			return this;
		}

		public WxMpTemplateMessage.WxMpTemplateMessageBuilder url(String url) {
			this.url = url;
			return this;
		}

		public WxMpTemplateMessage.WxMpTemplateMessageBuilder miniProgram(WxMpTemplateMessage.MiniProgram miniProgram) {
			this.miniProgram = miniProgram;
			return this;
		}

		public WxMpTemplateMessage.WxMpTemplateMessageBuilder data(List<WxMpTemplateData> data) {
			this.data = data;
			return this;
		}

		public WxMpTemplateMessage build() {
			return new WxMpTemplateMessage(this.toUser, this.templateId, this.url, this.miniProgram, this.data);
		}

		@Override
		public String toString() {
			return "WxMpTemplateMessage.WxMpTemplateMessageBuilder(toUser=" + this.toUser + ", templateId=" + this.templateId + ", url=" + this.url + ", miniProgram=" + this.miniProgram + ", data=" + this.data + ")";
		}
	}

	public static class MiniProgram implements Serializable {
		private static final long serialVersionUID = -7945254706501974849L;
		private String appid;
		private String pagepath;

		public MiniProgram() {
		}

		@ConstructorProperties({"appid", "pagepath"})
		public MiniProgram(String appid, String pagepath) {
			this.appid = appid;
			this.pagepath = pagepath;
		}

		public String getAppid() {
			return this.appid;
		}

		public void setAppid(String appid) {
			this.appid = appid;
		}

		public String getPagepath() {
			return this.pagepath;
		}

		public void setPagepath(String pagepath) {
			this.pagepath = pagepath;
		}

		@Override
		public boolean equals(Object o) {
			if (o == this) {
				return true;
			} else if (!(o instanceof WxMpTemplateMessage.MiniProgram)) {
				return false;
			} else {
				WxMpTemplateMessage.MiniProgram other = (WxMpTemplateMessage.MiniProgram) o;
				if (!other.canEqual(this)) {
					return false;
				} else {
					Object this$appid = this.getAppid();
					Object other$appid = other.getAppid();
					if (this$appid == null) {
						if (other$appid != null) {
							return false;
						}
					} else if (!this$appid.equals(other$appid)) {
						return false;
					}

					Object this$pagepath = this.getPagepath();
					Object other$pagepath = other.getPagepath();
					if (this$pagepath == null) {
						if (other$pagepath != null) {
							return false;
						}
					} else if (!this$pagepath.equals(other$pagepath)) {
						return false;
					}

					return true;
				}
			}
		}

		protected boolean canEqual(Object other) {
			return other instanceof WxMpTemplateMessage.MiniProgram;
		}

		@Override
		public int hashCode() {
			int result = 1;
			Object $appid = this.getAppid();
			result = result * 59 + ($appid == null ? 43 : $appid.hashCode());
			Object $pagepath = this.getPagepath();
			result = result * 59 + ($pagepath == null ? 43 : $pagepath.hashCode());
			return result;
		}

		@Override
		public String toString() {
			return "WxMpTemplateMessage.MiniProgram(appid=" + this.getAppid() + ", pagepath=" + this.getPagepath() +
					")";
		}
	}
}
